package com.graduate.cec.service;


import com.graduate.cec.common.ResponseCode;
import com.graduate.cec.exception.CecServiceException;
import com.graduate.cec.mapper.UserRoleMapper;
import com.graduate.cec.pojo.entity.UserRole;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UserRoleService {
    @Autowired
    UserRoleMapper userRoleMapper;



    public void insertRegister(Long userId){
        UserRole userRole = new UserRole();
        userRole.setUserId(userId);
        userRole.setRoleId(3L);
        int i = userRoleMapper.insertSelective(userRole);
        if (i == 0){
            throw new CecServiceException(ResponseCode.INSERT_INFO_ERROR,"插入关系表失败!");
        }
    }
}
